<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;
use GuzzleHttp\Client;
use Illuminate\Support\Facades\Storage;
class BrushVotes extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'BrushVotes:index';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Command description';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        //
		// $s = Storage::disk('oss_local_3gimg-zhuokearts');
        $this->rename_file('3img-zhuokearts', './auction.pics/2018/6/5/');
    }

    public function rename_file($disk, $file)
    {
        $variable = Storage::disk($disk)->allFiles($file);
        // dd($variable);
        foreach ($variable as $key => $value) {
            # code...
            if(strstr($value, '.JPG'))
            {
                Storage::disk($disk)->rename($value, strtolower($value));
            }
            echo $value.chr(10);
        }
        print_r(($variable));
    }
}
